const readline = require('readline');

// 创建readline接口实例
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

// 用于存储输入行的数组
let n, t, r; // 表示产品数, 最投资, 总风险
let earnArr = []
let riskArr = []
let maxArr = []

// 读取输入行的事件监听
rl.on("line", (line) => {
    if (n === undefined) {
        [n, t, r] = line.trim().split(/\s+/).map(Number)
    } else if (earnArr.length === 0) {
        earnArr = line.trim().split(/\s+/).map(Number)
    } else if (riskArr.length === 0) {
        riskArr = line.trim().split(/\s+/).map(Number)
    } else if (maxArr.length === 0) {
        maxArr = line.trim().split(/\s+/).map(Number)
        console.log(getResult(n, t, r, earnArr, riskArr, maxArr))
        // clear
        n = t = r = 0
        earnArr.length = 0
        riskArr.length = 0
        maxArr.length = 0
        rl.close()
    }
})

function getResult(n, t, r, earnArr, riskArr, maxArr) {
    let ans = new Array(n).fill(0)
    let result = 0
    // 遍历单个商品, 找答案
    for (let i = 0; i < n; i++) {
        if (riskArr[i] <= r) {
            let max = Math.min(t, maxArr[i])
            let temp = max * earnArr[i]
            if (temp > result) {
                result = temp
                ans = new Array(n).fill(0)
                ans[i] = max
            }
        }
    }

    // 遍历2个商品找答案
    for (let i = 0; i < n - 1; i++) {
        for (let j = i + 1; j < n; j++) {
            // 满足风险
            if (riskArr[i] + riskArr[j] <= r) {
                // 多买更赚钱项目
                let iCount, jCount;
                if (earnArr[i] >= earnArr[j]) {
                    iCount = Math.min(t, maxArr[i])
                    jCount = Math.min(maxArr[j], t - iCount)
                } else {
                    jCount = Math.min(t, maxArr[j])
                    iCount = Math.min(maxArr[i], t - jCount)
                }
                let temp = iCount * earnArr[i] + jCount * earnArr[j]
                if (temp > result) {
                    result = temp
                    ans = new Array(n).fill(0)
                    ans[i] = iCount
                    ans[j] = jCount
                }
            }
        }
    }
    return ans.join(" ")
}